package com.dit.serviceImpl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.dit.dao.SmeMapper;
import com.dit.entity.AbstractEntity;
import com.dit.entity.Sme;
import com.dit.service.SmeService;
import com.dit.util.GuidGenerator;

@Service("smeService")
public class SmeServiceImpl extends AbstractService implements SmeService {

	@Autowired
	private SmeMapper smeMapper;

	@Override
	public int addSme(Sme sme) {

		setInsertSettings(sme, "0");

		return smeMapper.insertSelective(sme);

	}

	@Override
	public List<Sme> findAll() {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public List<Sme> findAllNotDisabled() {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public List<Sme> findAllDisabled() {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public Sme findById(String id) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public int delete(String id) {
		return smeMapper.deleteByPrimaryKey(id);
		
	}

	@Override
	public int save(Sme entity, String userId) {
		
		entity.setId(GuidGenerator.smeKey());
		setInsertSettings(entity, "0");

		return smeMapper.insertSelective(entity);
	}

	@Override
	public int update(Sme entity, String userId) {
		
		setUpdateSettings(entity, userId);
		return smeMapper.updateByPrimaryKey(entity);
	}

	@Override
	public List<Sme> getSmeList() {
		return smeMapper.selectAll();
		
	}

	@Override
	public Sme getDetailsById(String id) {
		return smeMapper.selectByPrimaryKey(id);
		
	}

	@Override
	public Sme getSmeById(String id) {
		return smeMapper.selectByPrimaryKey(id);
		
	}

	
	/*@Override
	public int updateSme(Sme entity) {
		
		setInsertSettings(entity, "0");
		return smeMapper.updateByPrimaryKey(entity);
		
	}*/

}
